//
//  ViewController.m
//  IOS-image1
//
//  Created by RIOS on 2018/3/27.
//  Copyright © 2018年 RIOS. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIButton *image;

- (IBAction)btnLeft:(UIButton *)sender;
- (IBAction)btnUp:(UIButton *)sender;
- (IBAction)btnRight:(UIButton *)sender;
- (IBAction)btnDown:(UIButton *)sender;
- (IBAction)zoomBig:(UIButton *)sender;
- (IBAction)zoomSmall:(UIButton *)sender;


@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


- (IBAction)btnLeft:(UIButton *)sender {
    CGRect frame =  self.image.frame;
    frame.origin.x -=100;
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:0.5];
     self.image.frame = frame;
    [UIView commitAnimations];
    
}

- (IBAction)btnUp:(UIButton *)sender {
    CGRect frame =  self.image.frame;
    frame.origin.y -=100;
    self.image.frame = frame;

}

- (IBAction)btnRight:(UIButton *)sender {
    CGRect frame =  self.image.frame;
    frame.origin.x +=100;
    
    [UIView animateWithDuration:0.5 animations:^{
       self.image.frame = frame;
    }];

}

- (IBAction)btnDown:(UIButton *)sender {
    CGRect frame =  self.image.frame;
    frame.origin.y +=100;
    self.image.frame = frame;

}

- (IBAction)zoomBig:(UIButton *)sender {
   
    [UIView animateWithDuration:0.5 animations:^{
        [self anim:100];
    }];

}

- (void)anim:(int)size{
    CGRect frame =  self.image.frame;
    frame.size.height +=size;
    frame.size.width +=size;
    self.image.frame = frame;
}

- (IBAction)zoomSmall:(UIButton *)sender {
    
    [UIView animateWithDuration:0.5 animations:^{
        [self anim:-100];
    }];
}
@end






